package com.hireceivecard.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;
/**
 *
 * @Description: 配置要放行的端口
 * @Author 2742866928@qq.com
 * @Date: 2024/3/24 0:14
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private TokenInterceptor tokenInterceptor;
    /**
     * 拦截过滤器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册自己的拦截器,并设置拦截的请求路径
        //addPathPatterns为拦截此请求路径的请求，拦截是为了认证是否登录。所以下面的发短信，注册不需要拦截
        //excludePathPatterns为不拦截此路径的请求
        registry.addInterceptor(tokenInterceptor)
                .excludePathPatterns("/**");
//                .addPathPatterns("/**")
//                .excludePathPatterns("admin/login")
//                .excludePathPatterns("/admin/create")
//                .excludePathPatterns("user/login")
//                .excludePathPatterns("/user/create")
//                .excludePathPatterns("/swagger-ui.html/**")//swagger所需奇奇怪怪的入口
//                .excludePathPatterns("/swagger-resources/**")//swagger所需奇奇怪怪的入口
//                .excludePathPatterns("/doc.html");

    }
}
